<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*, java.util.*, java.io.File, jxl.*" errorPage="" %>
<%@ page import="cn.edu.hit.db.*" %>
<html>
<head>
<title>import</title>
</head>
<body>
<%
	DBTools dbtools = new DBTools();
	try{
		File file = new File("G:/eclipse/workplace/公寓中心/2011春博-公寓.xls");
		Workbook wb = Workbook.getWorkbook(file);
		Sheet sheet = wb.getSheet(0);
		for(int i=1; i<sheet.getRows(); i++){
			String id = sheet.getCell(0, i).getContents();
			String name = sheet.getCell(1, i).getContents();
			String sql = "insert into student values('"+id+"','"+name+"',NULL,NULL,NULL,NULL,NULL,NULL,0)";
			System.out.println(sql);
			dbtools.executeUpdate(sql);
			out.print(id+","+name+"<br/>");
		}
	}catch(Exception e){
		e.printStackTrace();
	}finally{
		dbtools.close();
	}
%>
</body>
</html>
